<!DOCTYPE html>  
  
<html>  
<head>  
    <title>高德地图</title>  
    <meta charset = "UTF-8" />  
    <script src="http://webapi.amap.com/maps?v=1.2&key=662b7a5d373bccb29453167d08245aef" type="text/javascript"></script>  
    <script>  
        var mapObj;  
        function getCoordinate(location){  
            var geocoderOption = {  
                range:300,//范围  
                crossnum:2,//道路交叉口数  
                roadnum:3,//路线记录数  
                poinum:2//POI点数  
            };  
            var geocoder = new AMap.Geocoder(geocoderOption);  
            geocoder.geocode(location, function(data){  
                var x = (data.list)[0].x;  
                var y = (data.list)[0].y;  
                document.getElementById("result").innerHTML = x + "," + y;  
  
                var position=new AMap.LngLat(x,y);//创建中心点坐标  
                if (!mapObj) {  
                    mapObj=new AMap.Map("container",{center:position, level:18});//创建地图实例  
                }else {  
                    mapObj.setZoomAndCenter(18,position);  
                }  
            });  
        }  
    </script>  
    <style type="text/css">  
        html{height:100%}  
        body{height:100%;margin:0px;padding:0px}  
        #container{height:100%}  
    </style>  
</head>  
<body>  
    <div>  
        <input type="text" id="input1">  
        <button type="button" onclick="getCoordinate(document.getElementById('input1').value)">查询坐标</button>  
    </div>  
    <div id="result"></div>  
    <div id="container"></div>  
</body>  
</html>  